﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Enter.Mvc.Base.Controllers;
using System.Web.Mvc;
using Enter.Services.Statistics;
using Enter.Services.Statistics.DTO;
using Enter.Common.Statistics;

namespace Enter.Mvc.Statistics.Controllers
{
	public class ImgController : BaseControllers
	{
		private readonly IStatistics istat;

		public ImgController(IStatistics istat)
		{
			this.istat = istat;
		}

		public ActionResult Index()
		{
			UserPvInfo userinfo = new UserPvInfo();
			int userid = istat.GetUserId(HttpContext);
			if (userid > 0)
			{
				bool isvip = istat.CheckUserPermission(userid);
				//return File();
				if (isvip)
				{
					userinfo=istat.ShowUserPvInfo(userid);
				}
				else
				{
					userinfo.UserimgType = ImgStateType.过期;
				}
			}
			else
			{
				userinfo.UserimgType = ImgStateType.错误;
			}
			byte[] imgbyte = istat.ImgSrc(userinfo);

			return null;
		}
	}
}
